import json

from flask import Blueprint, request
from flask_restful import Resource, Api

# 编辑功能
Delete = Blueprint('delete', __name__)
api = Api(Delete)


class delete(Resource):
    def get(self):
        # reqJson = json.loads(request.data)
        # print(reqJson)
        dcContents = {}
        dcContents["key"] = "aaabbbccc"
        res = setResult(dcContents)
        return res

    def post(self):
        reqJson = json.loads(request.data)
        print(reqJson)
        res = setResult("删除成功!")
        return res


api.add_resource(delete, '/delete')

def setResult(data):
    """
    通用返回数据格式
    :param data: 详细数据
    :return: result
    """
    result = {"code": 200, "message": "删除成功", "data": data}
    return result